<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>新mbp到了搭建开发环境过程 | showurl&#39;s blog</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials">
    <meta name="description" content="用于搭建、开发、解决问题的记录～">
    <meta property="og:url" content="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B.html">
    <meta property="og:site_name" content="showurl's blog">
    <meta property="og:title" content="新mbp到了搭建开发环境过程">
    <meta property="og:description" content="新mbp到了搭建开发环境过程 配置 系统设置 1.开启三指拖移 2.开启任何来源 3.开发者命令行工具 安装软件 1.软件列表 ClashX (; 懂得都懂) 'https://github.91chifun.workers.dev/https://github.com//yichengchen/clashX/releases/download/1.71.0">
    <meta property="og:type" content="article">
    <meta property="og:locale" content="en-US">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:image:alt" content="showurl's blog">
    <meta name="theme-color" content="#46bd87">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
    
    <link rel="preload" href="/assets/css/0.styles.ae7e6bb9.css" as="style"><link rel="preload" href="/assets/js/app.e8388aea.js" as="script"><link rel="preload" href="/assets/js/vendors~layout-Layout.be7e8cd7.js" as="script"><link rel="preload" href="/assets/js/vendors~layout-Blog~layout-Layout~layout-NotFound.4f2b52fc.js" as="script"><link rel="preload" href="/assets/js/page-新mbp到了搭建开发环境过程.4eb65bf3.js" as="script"><link rel="preload" href="/assets/js/vendors~layout-Blog~layout-Layout~layout-NotFound~layout-Slide.82815501.js" as="script"><link rel="prefetch" href="/assets/js/13.482b3c71.js"><link rel="prefetch" href="/assets/js/layout-Blog.751d0cd2.js"><link rel="prefetch" href="/assets/js/layout-Layout.f3e9cb51.js"><link rel="prefetch" href="/assets/js/layout-NotFound.efda544d.js"><link rel="prefetch" href="/assets/js/layout-Slide.78847583.js"><link rel="prefetch" href="/assets/js/page-主页.6acfc254.js"><link rel="prefetch" href="/assets/js/page-记一次gitlab安全漏洞修复.34bec515.js"><link rel="prefetch" href="/assets/js/vendors~photo-swipe.42668eb8.js">
    <link rel="stylesheet" href="/assets/css/0.styles.ae7e6bb9.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container has-navbar has-anchor"><header class="navbar"><!----> <div class="content__navbar-start"></div> <button title="Sidebar Button" class="sidebar-button"><span class="icon"></span></button> <a href="/" class="home-link router-link-active"><!----> <!----> <span class="site-name can-hide">showurl's blog</span></a> <!----> <div class="content__navbar-center"></div> <div class="links"><button tabindex="-1" aria-hidden="true" class="color-button"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="skin-icon"><path d="M224 800c0 9.6 3.2 44.8 6.4 54.4 6.4 48-48 76.8-48 76.8s80 41.6 147.2 0 134.4-134.4
        38.4-195.2c-22.4-12.8-41.6-19.2-57.6-19.2C259.2 716.8 227.2 761.6 224 800zM560 675.2l-32
        51.2c-51.2 51.2-83.2 32-83.2 32 25.6 67.2 0 112-12.8 128 25.6 6.4 51.2 9.6 80 9.6 54.4 0
        102.4-9.6 150.4-32l0 0c3.2 0 3.2-3.2 3.2-3.2 22.4-16 12.8-35.2
        6.4-44.8-9.6-12.8-12.8-25.6-12.8-41.6 0-54.4 60.8-99.2 137.6-99.2 6.4 0 12.8 0 22.4
        0 12.8 0 38.4 9.6 48-25.6 0-3.2 0-3.2 3.2-6.4 0-3.2 3.2-6.4 3.2-6.4 6.4-16 6.4-16 6.4-19.2
        9.6-35.2 16-73.6 16-115.2 0-105.6-41.6-198.4-108.8-268.8C704 396.8 560 675.2 560 675.2zM224
        419.2c0-28.8 22.4-51.2 51.2-51.2 28.8 0 51.2 22.4 51.2 51.2 0 28.8-22.4 51.2-51.2 51.2C246.4
        470.4 224 448 224 419.2zM320 284.8c0-22.4 19.2-41.6 41.6-41.6 22.4 0 41.6 19.2 41.6 41.6 0
        22.4-19.2 41.6-41.6 41.6C339.2 326.4 320 307.2 320 284.8zM457.6 208c0-12.8 12.8-25.6 25.6-25.6
        12.8 0 25.6 12.8 25.6 25.6 0 12.8-12.8 25.6-25.6 25.6C470.4 233.6 457.6 220.8 457.6 208zM128
        505.6C128 592 153.6 672 201.6 736c28.8-60.8 112-60.8 124.8-60.8-16-51.2 16-99.2
        16-99.2l316.8-422.4c-48-19.2-99.2-32-150.4-32C297.6 118.4 128 291.2 128 505.6zM764.8
        86.4c-22.4 19.2-390.4 518.4-390.4 518.4-22.4 28.8-12.8 76.8 22.4 99.2l9.6 6.4c35.2 22.4
        80 12.8 99.2-25.6 0 0 6.4-12.8 9.6-19.2 54.4-105.6 275.2-524.8 288-553.6
        6.4-19.2-3.2-32-19.2-32C777.6 76.8 771.2 80 764.8 86.4z"></path></svg> <div class="color-picker-menu" style="display:none;"><div class="theme-options"><!----> <div class="darkmode-toggle"><label for="darkmode-toggle" class="desc">Theme Mode:</label> <div class="darkmode-switch"><div class="item day"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon light-icon"><path d="M512 256a42.667 42.667 0 0 0 42.667-42.667V128a42.667 42.667 0 0 0-85.334 0v85.333A42.667 42.667 0 0 0 512 256zm384 213.333h-85.333a42.667 42.667 0 0 0 0 85.334H896a42.667 42.667 0 0 0 0-85.334zM256 512a42.667 42.667 0 0 0-42.667-42.667H128a42.667 42.667 0 0 0 0 85.334h85.333A42.667 42.667 0 0 0 256 512zm9.387-298.667a42.667 42.667 0 0 0-59.307 62.72l61.44 59.307a42.667 42.667 0 0 0 31.147 11.947 42.667 42.667 0 0 0 30.72-13.227 42.667 42.667 0 0 0 0-60.16zm459.946 133.974a42.667 42.667 0 0 0 29.44-11.947l61.44-59.307a42.667 42.667 0 0 0-57.6-62.72l-61.44 60.587a42.667 42.667 0 0 0 0 60.16 42.667 42.667 0 0 0 28.16 13.227zM512 768a42.667 42.667 0 0 0-42.667 42.667V896a42.667 42.667 0 0 0 85.334 0v-85.333A42.667 42.667 0 0 0 512 768zm244.48-79.36a42.667 42.667 0 0 0-59.307 61.44l61.44 60.587a42.667 42.667 0 0 0 29.44 11.946 42.667 42.667 0 0 0 30.72-12.8 42.667 42.667 0 0 0 0-60.586zm-488.96 0-61.44 59.307a42.667 42.667 0 0 0 0 60.586 42.667 42.667 0 0 0 30.72 12.8 42.667 42.667 0 0 0 28.587-10.666l61.44-59.307a42.667 42.667 0 0 0-59.307-61.44zM512 341.333A170.667 170.667 0 1 0 682.667 512 170.667 170.667 0 0 0 512 341.333z" fill="currentColor"></path></svg></div> <div class="item auto active"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon auto-icon"><path d="M460.864 539.072H564.8L510.592 376l-49.728 163.072zM872 362.368V149.504H659.648L510.528 0l-149.12 149.504H149.12v212.928L0 511.872l149.12 149.504v212.928h212.352l149.12 149.504 149.12-149.504h212.352V661.376l149.12-149.504L872 362.368zM614.464 693.12l-31.616-90.624H438.272l-31.616 90.624h-85.888l144.576-407.68h90.368l144.576 407.68h-85.824zm0 0" fill="currentColor"></path></svg></div> <div class="item night"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon dark-icon"><path d="M935.539 630.402c-11.43-11.432-28.674-14.739-43.531-8.354-46.734 20.103-96.363 30.297-147.508 30.297-99.59 0-193.221-38.784-263.64-109.203-108.637-108.637-139.61-270.022-78.908-411.148a39.497 39.497 0 0 0-51.886-51.887c-52.637 22.64-100.017 54.81-140.826 95.616-85.346 85.346-132.346 198.821-132.346 319.52 0 120.7 47.001 234.172 132.347 319.519S408.063 947.11 528.76 947.11c120.7 0 234.172-47.003 319.52-132.351 40.809-40.81 72.978-88.19 95.616-140.826a39.497 39.497 0 0 0-8.356-43.532z" fill="currentColor"></path></svg></div></div> <!----></div></div></div></button> <div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"></nav> <!----> <!----> <!----> <div class="content__navbar-end"></div></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <!----> <div class="content__sidebar-top"></div> <nav class="sidebar-nav-links"> <!----></nav> <!----> <div class="content__sidebar-center"></div> <!----> <!----> <div class="content__sidebar-bottom"></div> <!----></aside> <main class="page"><nav class="breadcrumb disable"><!----></nav> <!----> <div class="content__page-top"></div> <div vocab="https://schema.org/" typeof="Article" class="page-title"><h1><!----> <span property="headline">新mbp到了搭建开发环境过程</span></h1> <div class="page-info"><!----> <!----><!----><span aria-label="Writing Date📅" data-balloon-pos="down" class="time-info"><svg viewBox="0 0 1030 1024" xmlns="http://www.w3.org/2000/svg" class="icon calendar-icon"><path d="M716.4 110.137c0-18.753-14.72-33.473-33.472-33.473-18.753 0-33.473 14.72-33.473 33.473v33.473h66.993v-33.473zm-334.87 0c0-18.753-14.72-33.473-33.473-33.473s-33.52 14.72-33.52 33.473v33.473h66.993v-33.473zm468.81 33.52H716.4v100.465c0 18.753-14.72 33.473-33.472 33.473a33.145 33.145 0 0 1-33.473-33.473V143.657H381.53v100.465c0 18.753-14.72 33.473-33.473 33.473a33.145 33.145 0 0 1-33.473-33.473V143.657H180.6A134.314 134.314 0 0 0 46.66 277.595v535.756A134.314 134.314 0 0 0 180.6 947.289h669.74a134.36 134.36 0 0 0 133.94-133.938V277.595a134.314 134.314 0 0 0-133.94-133.938zm33.473 267.877H147.126a33.145 33.145 0 0 1-33.473-33.473c0-18.752 14.72-33.473 33.473-33.473h736.687c18.752 0 33.472 14.72 33.472 33.473a33.145 33.145 0 0 1-33.472 33.473z" fill="currentColor"></path></svg> <span property="datePublished">2021-11-11</span></span><!----><!----><span aria-label="Reading Time⌛" data-balloon-pos="down" class="reading-time-info"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon timer-icon"><path d="M799.387 122.15c4.402-2.978 7.38-7.897 7.38-13.463v-1.165c0-8.933-7.38-16.312-16.312-16.312H256.33c-8.933 0-16.311 7.38-16.311 16.312v1.165c0 5.825 2.977 10.874 7.637 13.592 4.143 194.44 97.22 354.963 220.201 392.763-122.204 37.542-214.893 196.511-220.2 389.397-4.661 5.049-7.638 11.651-7.638 19.03v5.825h566.49v-5.825c0-7.379-2.849-13.981-7.509-18.9-5.049-193.016-97.867-351.985-220.2-389.527 123.24-37.67 216.446-198.453 220.588-392.892zM531.16 450.445v352.632c117.674 1.553 211.787 40.778 211.787 88.676H304.097c0-48.286 95.149-87.382 213.728-88.676V450.445c-93.077-3.107-167.901-81.297-167.901-177.093 0-8.803 6.99-15.793 15.793-15.793 8.803 0 15.794 6.99 15.794 15.793 0 80.261 63.69 145.635 142.01 145.635s142.011-65.374 142.011-145.635c0-8.803 6.99-15.793 15.794-15.793s15.793 6.99 15.793 15.793c0 95.019-73.789 172.82-165.96 177.093z" fill="currentColor"></path></svg> <span>About 9 min</span> <meta property="timeRequired" content="PT9M"></span></div> <!----> <hr></div> <div class="anchor-place-holder"><aside id="anchor"><div class="anchor-wrapper"><ul class="anchor-list"><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#配置" class="anchor-link heading2"><div>配置</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#系统设置" class="anchor-link heading2"><div>系统设置</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#_1-开启三指拖移" class="anchor-link heading3"><div>1.开启三指拖移</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#_2-开启任何来源" class="anchor-link heading3"><div>2.开启任何来源</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#_3-开发者命令行工具" class="anchor-link heading3"><div>3.开发者命令行工具</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#安装软件" class="anchor-link heading2"><div>安装软件</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#_1-软件列表" class="anchor-link heading3"><div>1.软件列表</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#_2-sdk下载安装" class="anchor-link heading3"><div>2.SDK下载安装</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#_3-软件初始化设置" class="anchor-link heading3"><div>3.软件初始化设置</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#docker搭建开发环境" class="anchor-link heading2"><div>docker搭建开发环境</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#初始设置" class="anchor-link heading3"><div>初始设置</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#docker搭建mysql-8-0-18" class="anchor-link heading3"><div>docker搭建mysql:8.0.18</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#docker搭建-redis-with-bloomfilter" class="anchor-link heading3"><div>docker搭建 rediswithbloomfilter</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#docker搭建etcd-我自己的arm版镜像" class="anchor-link heading3"><div>docker搭建etcd 我自己的arm版镜像</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#es" class="anchor-link heading3"><div>es</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#kibana" class="anchor-link heading3"><div>kibana</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#rocketmq" class="anchor-link heading3"><div>rocketmq</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#cassandra4-0-1三节点集群" class="anchor-link heading3"><div>Cassandra4.0.1三节点集群</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#mongodb单节点" class="anchor-link heading3"><div>MongoDB单节点</div></a></li><li class="anchor"><a href="/%E6%96%B0mbp%E5%88%B0%E4%BA%86%E6%90%AD%E5%BB%BA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E8%BF%87%E7%A8%8B/#mongodb分片副本集" class="anchor-link heading3"><div>MongoDB分片副本集</div></a></li></ul></div></aside></div> <!----> <div class="content__content-top"></div> <div class="theme-default-content content__default"><h1 id="新mbp到了搭建开发环境过程"><a href="#新mbp到了搭建开发环境过程" class="header-anchor">#</a> 新mbp到了搭建开发环境过程</h1> <h2 id="配置"><a href="#配置" class="header-anchor">#</a> 配置</h2> <div class="language-markdown line-numbers-mode"><pre class="language-markdown"><code>10月20号订的货 M1 MAX 24核GPU 64G内存 1T硬盘 对开发来说32G内存够用好几年了 考虑到可能会在虚拟机里跑k8s集群 选择了64GB内存
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><img src="/assets/img/封面图.df3c0786.png" alt=""> <h2 id="系统设置"><a href="#系统设置" class="header-anchor">#</a> 系统设置</h2> <h3 id="_1-开启三指拖移"><a href="#_1-开启三指拖移" class="header-anchor">#</a> 1.开启三指拖移</h3> <div class="language-markdown line-numbers-mode"><pre class="language-markdown"><code>系统偏好设置-&gt;辅助功能-&gt;指针控制-&gt;触控板选项-&gt;启用拖移-&gt;三指拖移
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><img src="/assets/img/三指拖移.99c88a6a.png" alt=""> <h3 id="_2-开启任何来源"><a href="#_2-开启任何来源" class="header-anchor">#</a> 2.开启任何来源</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">sudo</span> spctl --master-disable
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="_3-开发者命令行工具"><a href="#_3-开发者命令行工具" class="header-anchor">#</a> 3.开发者命令行工具</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>xcode-select --install
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="安装软件"><a href="#安装软件" class="header-anchor">#</a> 安装软件</h2> <h3 id="_1-软件列表"><a href="#_1-软件列表" class="header-anchor">#</a> 1.软件列表</h3> <ul><li>ClashX (
懂得都懂) 'https://github.91chifun.workers.dev/https://github.com//yichengchen/clashX/releases/download/1.71.0/ClashX.dmg'</li> <li>XCode</li> <li>Logic Pro</li> <li>Final Cut Pro</li> <li>Motrix (多线程下载工具)</li> <li>Axure PR 9 (打开产品原型图)</li> <li>XMind (思维导图)</li> <li>Apifox (Api文档记录&amp;调试工具)</li> <li>Proxifier (远程办公必备)</li> <li>钉钉QQ微信百度网盘</li> <li>Typora (markdown文档编辑器)</li> <li>Navicat (SQL可视化工具)</li> <li>Another Redis Desktop Manager (免费开源的redis可视化工具)</li> <li>Microsoft Excel (微软Excel表格)</li> <li>chrome (开发者必备)</li> <li>Docker (容器技术)</li> <li>Parallels Desktop (虚拟机软件)</li> <li>iStat Menus (状态栏资源占用显示)</li> <li>VS Code (轻量文本编辑)</li> <li>jetbrains IDEA (Java Flutter)</li> <li>jetbrains Goland (Golang)</li> <li>jetbrains Pycharm (Python)</li> <li>jetbrains WebStorm (nodejs)</li></ul> <h3 id="_2-sdk下载安装"><a href="#_2-sdk下载安装" class="header-anchor">#</a> 2.SDK下载安装</h3> <h4 id="创建sdk目录"><a href="#创建sdk目录" class="header-anchor">#</a> - 创建sdk目录</h4> <div class="language-markdown line-numbers-mode"><pre class="language-markdown"><code>用到的sdk很多 所以放进一个目录统一管理
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">mkdir</span> -p ~/sdk/jdk
<span class="token function">mkdir</span> -p ~/sdk/golang
<span class="token function">mkdir</span> -p ~/sdk/nodejs
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h4 id="python-使用miniforge"><a href="#python-使用miniforge" class="header-anchor">#</a> -Python(使用miniForge)</h4> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 先下载miniForge</span>
<span class="token comment"># 官方网站 https://github.com/conda-forge/miniforge/releases</span>
<span class="token comment"># 下载地址 https://github.91chifun.workers.dev/https://github.com//conda-forge/miniforge/releases/download/4.10.3-7/Miniforge3-MacOSX-arm64.sh</span>
<span class="token function">curl</span> -o ~/Downloads/Miniforge3-MacOSX-arm64.sh <span class="token punctuation">\</span>
<span class="token string">'https://github.91chifun.workers.dev/https://github.com//conda-forge/miniforge/releases/download/4.10.3-7/Miniforge3-MacOSX-arm64.sh'</span>
<span class="token builtin class-name">cd</span> ~/Downloads/
./Miniforge3-MacOSX-arm64.sh
<span class="token comment"># 会创建~/miniforge3目录</span>
conda --version
<span class="token comment"># 就可以创建虚拟环境了 用到的时候再说</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><h4 id="zulu-jdk-8"><a href="#zulu-jdk-8" class="header-anchor">#</a> -Zulu JDK 8</h4> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 官网地址 https://www.azul.com/downloads/?version=java-8-lts&amp;os=macos&amp;architecture=arm-64-bit&amp;package=jdk</span>
<span class="token comment"># 我选择的jdk8版本</span>
<span class="token function">curl</span> -o ~/Downloads/jdk8.tar.gz <span class="token punctuation">\</span>
https://cdn.azul.com/zulu/bin/zulu8.58.0.13-ca-jdk8.0.312-macosx_aarch64.tar.gz
<span class="token comment"># curl下载速度很慢 可以使用Motrix进行下载</span>
<span class="token comment"># 下载好之后移动到sdk目录</span>
<span class="token function">mv</span> ~/Downloads/zulu8.58.0.13-ca-jdk8.0.312-macosx_aarch64 ~/sdk/jdk/8.0.312
<span class="token comment"># 编辑.zshrc文件 增加一行 export PATH=$PATH:$HOME/sdk/jdk/8.0.312/bin</span>
<span class="token function">vim</span> ~/.zshrc
<span class="token comment"># :wq保存退出</span>
<span class="token builtin class-name">source</span> ~/.zshrc
<span class="token comment"># 测试</span>
java -version 
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br></div></div><h4 id="golang1-17-3"><a href="#golang1-17-3" class="header-anchor">#</a> -Golang1.17.3</h4> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 官网地址 https://golang.org/dl/</span>
<span class="token comment"># 下载地址 https://golang.org/dl/go1.17.3.darwin-arm64.tar.gz</span>
<span class="token function">curl</span> -o ~/Downloads/go1.17.3.darwin-arm64.tar.gz <span class="token punctuation">\</span>
<span class="token string">'https://golang.org/dl/go1.17.3.darwin-arm64.tar.gz'</span>
<span class="token builtin class-name">cd</span> ~/Downloads
<span class="token function">tar</span> -zxvf go1.17.3.darwin-arm64.tar.gz
<span class="token function">mv</span> go1.17.3.darwin-arm64 ~/sdk/golang/1.17.3
<span class="token comment"># 编辑.zshrc文件 增加一行 export PATH=$PATH:$HOME/sdk/golang/1.17.3/bin</span>
<span class="token function">vim</span> ~/.zshrc
<span class="token comment"># :wq保存退出</span>
<span class="token builtin class-name">source</span> ~/.zshrc
<span class="token comment"># 测试</span>
go <span class="token function">env</span> 
<span class="token comment"># 设置go拉取依赖代理</span>
go <span class="token function">env</span> -w <span class="token assign-left variable">GOPROXY</span><span class="token operator">=</span><span class="token string">&quot;https://goproxy.cn,direct&quot;</span>
<span class="token comment"># 设置私有仓库地址 (没有可忽略)</span>
<span class="token comment"># go env -w GONOPROXY=&quot;gitlab.xxx.xx&quot;</span>
<span class="token comment"># go env -w GONOSUMDB=&quot;gitlab.xxx.xx&quot;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br></div></div><h4 id="nodejs12"><a href="#nodejs12" class="header-anchor">#</a> -nodejs12</h4> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 下载地址 https://github.91chifun.workers.dev/https://github.com//nodejs/node/archive/refs/tags/v12.22.6.tar.gz</span>
<span class="token function">curl</span> -o ~/Downloads/v12.22.6.tar.gz <span class="token punctuation">\</span>
<span class="token string">'https://github.91chifun.workers.dev/https://github.com//nodejs/node/archive/refs/tags/v12.22.6.tar.gz'</span>
<span class="token builtin class-name">cd</span> ~/Downloads/
<span class="token function">tar</span> -zxvf ~/Downloads/v12.22.6.tar.gz
<span class="token builtin class-name">cd</span> node-12.22.6
./configure --prefix<span class="token operator">=</span>/Users/<span class="token variable"><span class="token variable">$(</span><span class="token function">whoami</span><span class="token variable">)</span></span>/sdk/nodejs/12.22.6
<span class="token comment"># 8线程编译 如果你是丐版 可以6/7个线程编译</span>
<span class="token function">make</span> -j8 <span class="token operator">&amp;&amp;</span> <span class="token function">make</span> <span class="token function">install</span>
<span class="token comment"># 编辑.zshrc文件 增加一行 export PATH=$PATH:$HOME/sdk/nodejs/12.22.6/bin:$HOME/sdk/nodejs/12.22.6/third_lib/bin</span>
<span class="token function">vim</span> ~/.zshrc
<span class="token comment"># :wq保存退出</span>
<span class="token builtin class-name">source</span> ~/.zshrc
<span class="token comment"># 测试</span>
node -v
<span class="token function">npm</span> config <span class="token builtin class-name">set</span> prefix /Users/<span class="token variable"><span class="token variable">$(</span><span class="token function">whoami</span><span class="token variable">)</span></span>/sdk/nodejs/12.22.6/third_lib
<span class="token function">npm</span> config <span class="token builtin class-name">set</span> cache /Users/<span class="token variable"><span class="token variable">$(</span><span class="token function">whoami</span><span class="token variable">)</span></span>/sdk/nodejs/12.22.6/third_lib
<span class="token function">npm</span> <span class="token function">install</span> <span class="token function">yarn</span> -g
<span class="token function">yarn</span> -v
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br></div></div><h3 id="_3-软件初始化设置"><a href="#_3-软件初始化设置" class="header-anchor">#</a> 3.软件初始化设置</h3> <h4 id="jetbrains系列"><a href="#jetbrains系列" class="header-anchor">#</a> jetbrains系列</h4> <div class="language-markdown line-numbers-mode"><pre class="language-markdown"><code>插件仓库管理中新增一个仓库 https://plugins.zhile.io
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><img src="/assets/img/插件仓库.052d2f91.png" alt=""> <div class="language-markdown line-numbers-mode"><pre class="language-markdown"><code>搜索 &quot;IDE Eval Reset&quot;
下载使用
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><img src="/assets/img/jetbrains插件.33b8a101.png" alt=""> <h2 id="docker搭建开发环境"><a href="#docker搭建开发环境" class="header-anchor">#</a> docker搭建开发环境</h2> <h3 id="初始设置"><a href="#初始设置" class="header-anchor">#</a> 初始设置</h3> <ul><li>docker 新版本已经支持直接使用x86的镜像来构建容器
<img src="/assets/img/x86容器支持.c8272fac.png" alt=""></li></ul> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">mkdir</span> -p ~/docker
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>打开docker desktop -&gt; 首选项</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
  <span class="token property">&quot;registry-mirrors&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;https://4o8u9kwb.mirror.aliyuncs.com&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;https://reg-mirror.qiniu.com&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;https://hub-mirror.c.163.com&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;https://docker.mirrors.ustc.edu.cn&quot;</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h3 id="docker搭建mysql-8-0-18"><a href="#docker搭建mysql-8-0-18" class="header-anchor">#</a> docker搭建mysql:8.0.18</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>docker run --name mysql8.0.18 -p <span class="token number">3306</span>:3306 <span class="token punctuation">\</span>
-e <span class="token assign-left variable">MYSQL_ROOT_PASSWORD</span><span class="token operator">=</span><span class="token number">123456</span> -d mysql/mysql-server:8.0.18
docker <span class="token builtin class-name">exec</span> -it mysql8.0.18 /bin/bash
mysql -uroot -p123456
<span class="token comment"># 开启远程访问</span>
CREATE <span class="token environment constant">USER</span> <span class="token string">'root'</span>@<span class="token string">'%'</span> IDENTIFIED BY <span class="token string">'root'</span><span class="token punctuation">;</span>
GRANT ALL ON *.* TO <span class="token string">'root'</span>@<span class="token string">'%'</span><span class="token punctuation">;</span>
flush privileges<span class="token punctuation">;</span>
ALTER <span class="token environment constant">USER</span> <span class="token string">'root'</span>@<span class="token string">'%'</span> IDENTIFIED WITH mysql_native_password BY <span class="token string">'123456'</span><span class="token punctuation">;</span>
flush privileges<span class="token punctuation">;</span>
<span class="token comment"># 连接成功</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div><h3 id="docker搭建-redis-with-bloomfilter"><a href="#docker搭建-redis-with-bloomfilter" class="header-anchor">#</a> docker搭建 redis_with_bloomfilter</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>docker run -p <span class="token number">6379</span>:6379 <span class="token punctuation">\</span>
--name redis_with_bloomfilter2.2.9 -it <span class="token punctuation">\</span>
-d redislabs/rebloom:2.2.9
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><h3 id="docker搭建etcd-我自己的arm版镜像"><a href="#docker搭建etcd-我自己的arm版镜像" class="header-anchor">#</a> docker搭建etcd 我自己的arm版镜像</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>docker run -p <span class="token number">2379</span>:2379 -p <span class="token number">2380</span>:2380 -d <span class="token punctuation">\</span>
--name etcd-arm showurl/etcd-arm:latest <span class="token punctuation">\</span>
/usr/local/bin/etcd <span class="token punctuation">\</span>
-advertise-client-urls http://0.0.0.0:2379 <span class="token punctuation">\</span>
-listen-client-urls http://0.0.0.0:2379
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="es"><a href="#es" class="header-anchor">#</a> es</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">mkdir</span> -p ~/docker/elasticsearch7.14.1/conf
<span class="token function">mkdir</span> -p ~/docker/elasticsearch7.14.1/data
<span class="token function">mkdir</span> -p ~/docker/elasticsearch7.14.1/plugins
<span class="token function">cat</span> <span class="token operator">&lt;&lt;</span><span class="token string">EOF<span class="token bash punctuation"> <span class="token operator">&gt;</span>~/docker/elasticsearch7.14.1/conf/elasticsearch.yml</span>
cluster.name: &quot;docker-cluster&quot;
network.host: 0.0.0.0
EOF</span>
docker run --name elasticsearch7.14.1 <span class="token punctuation">\</span>
-p <span class="token number">9200</span>:9200 -p <span class="token number">9300</span>:9300 <span class="token punctuation">\</span>
-e <span class="token string">&quot;discovery.type=single-node&quot;</span> <span class="token punctuation">\</span>
-e <span class="token assign-left variable">ES_JAVA_OPTS</span><span class="token operator">=</span><span class="token string">&quot;-Xms64m -Xmx512m&quot;</span> <span class="token punctuation">\</span>
-v /Users/<span class="token variable"><span class="token variable">$(</span><span class="token function">whoami</span><span class="token variable">)</span></span>/docker/elasticsearch7.14.1/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml <span class="token punctuation">\</span>
-v /Users/<span class="token variable"><span class="token variable">$(</span><span class="token function">whoami</span><span class="token variable">)</span></span>/docker/elasticsearch7.14.1/data:/usr/share/elasticsearch/data <span class="token punctuation">\</span>
-v /Users/<span class="token variable"><span class="token variable">$(</span><span class="token function">whoami</span><span class="token variable">)</span></span>/docker/elasticsearch7.14.1/plugins:/usr/share/elasticsearch/plugins <span class="token punctuation">\</span>
-d elasticsearch:7.14.1
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br></div></div><h3 id="kibana"><a href="#kibana" class="header-anchor">#</a> kibana</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>docker run --name kibana7.14.1 <span class="token punctuation">\</span>
--link elasticsearch7.14.1:elasticsearch7.14.1  <span class="token punctuation">\</span>
-e <span class="token assign-left variable">ELASTICSEARCH_HOSTS</span><span class="token operator">=</span>http://elasticsearch7.14.1:9200 <span class="token punctuation">\</span>
-e <span class="token assign-left variable">I18N_LOCALE</span><span class="token operator">=</span>zh-CN <span class="token punctuation">\</span>
-p <span class="token number">5601</span>:5601 <span class="token punctuation">\</span>
-d kibana:7.14.1
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h3 id="rocketmq"><a href="#rocketmq" class="header-anchor">#</a> rocketmq</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">mkdir</span> -p ~/docker/maven/m2/repository
<span class="token function">mkdir</span> -p ~/docker/rocketmq4.9.2/logs
<span class="token function">mkdir</span> -p ~/docker/rocketmq4.9.2/store
<span class="token function">mkdir</span> -p ~/docker/rocketmq4.9.2/soft
docker run --name rocketmq4.9.2 -h rocketmq -d --privileged <span class="token punctuation">\</span>
-v ~/docker/maven/m2/repository:/root/.m2/repository <span class="token punctuation">\</span>
-v ~/docker/rocketmq4.9.2/logs:/root/logs <span class="token punctuation">\</span>
-v ~/docker/rocketmq4.9.2/store:/root/store <span class="token punctuation">\</span>
-v ~/docker/rocketmq4.9.2/soft:/root/soft <span class="token punctuation">\</span>
-e <span class="token assign-left variable">TZ</span><span class="token operator">=</span><span class="token string">'Asia/Shanghai'</span> <span class="token punctuation">\</span>
-e <span class="token assign-left variable">JAVA_OPT_EXT</span><span class="token operator">=</span><span class="token string">'-Xms128m -Xmx128m -Xmn64m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=32m'</span> <span class="token punctuation">\</span>
-p <span class="token number">10911</span>:10911 <span class="token punctuation">\</span>
-p <span class="token number">9876</span>:9876 <span class="token punctuation">\</span>
--security-opt seccomp:unconfined <span class="token punctuation">\</span>
registry.cn-beijing.aliyuncs.com/king019/rocketmq:4.9.2

docker run --name rocketmq-console-ng4.9.2 <span class="token punctuation">\</span>
--link rocketmq4.9.2:rocketmq  <span class="token punctuation">\</span>
--link rocketmq4.9.2:broker  <span class="token punctuation">\</span>
-e <span class="token string">&quot;JAVA_OPTS=-Drocketmq.config.namesrvAddr=rocketmq:9876 -Drocketmq.config.isVIPChannel=false&quot;</span> <span class="token punctuation">\</span>
-p <span class="token number">8180</span>:8180 <span class="token punctuation">\</span>
-d zhanyifan1997/rocketmq-console-ng:latest
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br></div></div><h3 id="cassandra4-0-1三节点集群"><a href="#cassandra4-0-1三节点集群" class="header-anchor">#</a> Cassandra4.0.1三节点集群</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">mkdir</span> -p ~/docker/cassandra4.0.1/conf
<span class="token function">mkdir</span> -p ~/docker/cassandra4.0.1/1/data
<span class="token function">mkdir</span> -p ~/docker/cassandra4.0.1/2/data
<span class="token function">mkdir</span> -p ~/docker/cassandra4.0.1/3/data
docker run --name cass --rm -it -d cassandra:4.0.1 /bin/bash
docker <span class="token function">cp</span> cass:/opt/cassandra/conf/cassandra.yaml ~/docker/cassandra4.0.1/conf/cassandra.yaml
docker stop cass
<span class="token comment"># 修改配置文件信息</span>
<span class="token function">sed</span> -i <span class="token string">&quot;&quot;</span> <span class="token string">&quot;s/authenticator: AllowAllAuthenticator/authenticator: PasswordAuthenticator/g&quot;</span> <span class="token punctuation">\</span>
~/docker/cassandra4.0.1/conf/cassandra.yaml 

<span class="token comment"># 创建一个自定义网段的网络</span>
docker network create --subnet<span class="token operator">=</span><span class="token number">172.20</span>.0.0/16 cassandra20
<span class="token comment"># 这是删除命令 docker network rm cassandra20</span>
docker run --name cassandra4.0.1-1 -d <span class="token punctuation">\</span>
--net cassandra20 --ip <span class="token number">172.20</span>.0.11 <span class="token punctuation">\</span>
-v ~/docker/cassandra4.0.1/conf/cassandra.yaml:/opt/cassandra/conf/cassandra.yaml <span class="token punctuation">\</span>
-v ~/docker/cassandra4.0.1/1/data:/var/lib/cassandra <span class="token punctuation">\</span>
-e <span class="token assign-left variable">CASSANDRA_BROADCAST_ADDRESS</span><span class="token operator">=</span><span class="token number">172.20</span>.0.11 <span class="token punctuation">\</span>
-p <span class="token number">7100</span>:7000 <span class="token punctuation">\</span>
-p <span class="token number">9142</span>:9042 <span class="token punctuation">\</span>
cassandra:4.0.1

docker run --name cassandra4.0.1-2 -d <span class="token punctuation">\</span>
--net cassandra20 --ip <span class="token number">172.20</span>.0.12 <span class="token punctuation">\</span>
-v ~/docker/cassandra4.0.1/conf/cassandra.yaml:/opt/cassandra/conf/cassandra.yaml <span class="token punctuation">\</span>
-v ~/docker/cassandra4.0.1/2/data:/var/lib/cassandra <span class="token punctuation">\</span>
-e <span class="token assign-left variable">CASSANDRA_BROADCAST_ADDRESS</span><span class="token operator">=</span><span class="token number">172.20</span>.0.12 <span class="token punctuation">\</span>
-e <span class="token assign-left variable">CASSANDRA_SEEDS</span><span class="token operator">=</span><span class="token number">172.20</span>.0.11 <span class="token punctuation">\</span>
-p <span class="token number">7200</span>:7000 <span class="token punctuation">\</span>
-p <span class="token number">9242</span>:9042 <span class="token punctuation">\</span>
cassandra:4.0.1

docker run --name cassandra4.0.1-3 -d <span class="token punctuation">\</span>
--net cassandra20 --ip <span class="token number">172.20</span>.0.13 <span class="token punctuation">\</span>
-v ~/docker/cassandra4.0.1/conf/cassandra.yaml:/opt/cassandra/conf/cassandra.yaml <span class="token punctuation">\</span>
-v ~/docker/cassandra4.0.1/3/data:/var/lib/cassandra <span class="token punctuation">\</span>
-e <span class="token assign-left variable">CASSANDRA_BROADCAST_ADDRESS</span><span class="token operator">=</span><span class="token number">172.20</span>.0.13 <span class="token punctuation">\</span>
-e <span class="token assign-left variable">CASSANDRA_SEEDS</span><span class="token operator">=</span><span class="token number">172.20</span>.0.11 <span class="token punctuation">\</span>
-p <span class="token number">7300</span>:7000 <span class="token punctuation">\</span>
-p <span class="token number">9342</span>:9042 <span class="token punctuation">\</span>
cassandra:4.0.1

<span class="token comment"># 测试一下</span>
docker run --net cassandra20 --ip <span class="token number">172.20</span>.0.21 <span class="token punctuation">\</span>
--name cass --rm -it cassandra:4.0.1 /bin/bash
cqlsh -u cassandra -pcassandra <span class="token number">172.20</span>.0.13
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br></div></div><div class="language-markdown line-numbers-mode"><pre class="language-markdown"><code><span class="token title important"><span class="token punctuation">#</span> 输出</span>

Connected to cassandra4.0.1 at 172.20.0.13:9042
[cqlsh 6.0.0 | Cassandra 4.0.1 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help. cassandra@cqlsh&gt; DESCRIBE CLUSTER

Cluster: cassandra4.0.1 Partitioner: Murmur3Partitioner Snitch: DynamicEndpointSnitch

cassandra@cqlsh&gt;
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h3 id="mongodb单节点"><a href="#mongodb单节点" class="header-anchor">#</a> MongoDB单节点</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">mkdir</span> -pv ~/docker/mongo5.0.3/<span class="token punctuation">{</span>conf,data<span class="token punctuation">}</span>
docker run -p <span class="token number">27017</span>:27017 <span class="token punctuation">\</span>
-v ~/docker/mongo5.0.3/data/:/data/db <span class="token punctuation">\</span>
-v ~/docker/mongo5.0.3/conf:/data/configdb <span class="token punctuation">\</span>
--name mongo_single -d mongo:5.0.3
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="mongodb分片副本集"><a href="#mongodb分片副本集" class="header-anchor">#</a> MongoDB分片副本集</h3> <p><a href="https://www.ackerc.com/2021/02/24/Docker-mongo-shard/" target="_blank"> 参考 </a></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 创建一个自定义网段的网络</span>
docker network create --subnet<span class="token operator">=</span><span class="token number">172.21</span>.0.0/16 mongo21
<span class="token comment"># 创建配置服务副本集</span>
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.11 <span class="token punctuation">\</span>
--name mongo-config-1 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --configsvr --replSet config --bind_ip_all
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.12 <span class="token punctuation">\</span>
--name mongo-config-2 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --configsvr --replSet config --bind_ip_all
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.13 <span class="token punctuation">\</span>
--name mongo-config-3 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --configsvr --replSet config --bind_ip_all
<span class="token comment">#所以三个服务副本的地址为</span>
<span class="token comment">#mongo-config-1: 172.21.0.11:27019</span>
<span class="token comment">#mongo-config-2: 172.21.0.12:27019</span>
<span class="token comment">#mongo-config-3: 172.21.0.13:27019 </span>
docker <span class="token builtin class-name">exec</span> -it mongo-config-1 /bin/bash
mongo --host <span class="token number">172.21</span>.0.11 --port <span class="token number">27019</span>
rs.initiate<span class="token punctuation">(</span><span class="token punctuation">{</span>
				_id:<span class="token string">&quot;config&quot;</span>,
				configsvr: true, 
				members:<span class="token punctuation">[</span>
					<span class="token punctuation">{</span>_id:1, host:<span class="token string">&quot;172.21.0.11:27019&quot;</span><span class="token punctuation">}</span>,
					<span class="token punctuation">{</span>_id:2, host:<span class="token string">&quot;172.21.0.12:27019&quot;</span><span class="token punctuation">}</span>,
					<span class="token punctuation">{</span>_id:3, host:<span class="token string">&quot;172.21.0.13:27019&quot;</span><span class="token punctuation">}</span>,
				<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment"># 创建分片副本集</span>
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.21 <span class="token punctuation">\</span>
--name mongo-shard-1 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --shardsvr --replSet shard --bind_ip_all
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.22 <span class="token punctuation">\</span>
--name mongo-shard-2 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --shardsvr --replSet shard --bind_ip_all
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.23 <span class="token punctuation">\</span>
--name mongo-shard-3 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --shardsvr --replSet shard --bind_ip_all


docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.31 <span class="token punctuation">\</span>
--name mongo-shard-11 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --shardsvr --replSet shard1 --bind_ip_all
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.32 <span class="token punctuation">\</span>
--name mongo-shard-12 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --shardsvr --replSet shard1 --bind_ip_all
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.33 <span class="token punctuation">\</span>
--name mongo-shard-13 mongo:5.0.3 <span class="token punctuation">\</span>
mongod --shardsvr --replSet shard1 --bind_ip_all
<span class="token comment"># 备注： --shardsvr 默认端口为 27018</span>
<span class="token comment">#所以三个服务副本的地址为(IP地址请参考实际情况)</span>
<span class="token comment">#mongo-shard-1: 172.21.0.21:27018</span>
<span class="token comment">#mongo-shard-2: 172.21.0.22:27018</span>
<span class="token comment">#mongo-shard-3: 172.21.0.23:27018   </span>
<span class="token comment">#</span>
<span class="token comment">#mongo-shard-11: 172.21.0.31:27018</span>
<span class="token comment">#mongo-shard-12: 172.21.0.32:27018</span>
<span class="token comment">#mongo-shard-13: 172.21.0.33:27018</span>
  
<span class="token comment"># 初始化分片副本集</span>
docker <span class="token builtin class-name">exec</span> -it mongo-shard-1 /bin/bash
mongo --host <span class="token number">172.21</span>.0.21 --port <span class="token number">27018</span>
rs.initiate<span class="token punctuation">(</span><span class="token punctuation">{</span>
				_id:<span class="token string">&quot;shard&quot;</span>,
				members:<span class="token punctuation">[</span>
					<span class="token punctuation">{</span>_id:1, host:<span class="token string">&quot;172.21.0.21:27018&quot;</span><span class="token punctuation">}</span>,
					<span class="token punctuation">{</span>_id:2, host:<span class="token string">&quot;172.21.0.22:27018&quot;</span><span class="token punctuation">}</span>,
					<span class="token punctuation">{</span>_id:3, host:<span class="token string">&quot;172.21.0.23:27018&quot;</span><span class="token punctuation">}</span>,
				<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span> 
<span class="token builtin class-name">exit</span>
<span class="token builtin class-name">exit</span>
<span class="token comment">#第二个分片副本集 shard</span>
docker <span class="token builtin class-name">exec</span> -it mongo-shard-11 /bin/bash
mongo --host <span class="token number">172.21</span>.0.31 --port <span class="token number">27018</span>
rs.initiate<span class="token punctuation">(</span><span class="token punctuation">{</span>
				_id:<span class="token string">&quot;shard1&quot;</span>,
				members:<span class="token punctuation">[</span>
					<span class="token punctuation">{</span>_id:1, host:<span class="token string">&quot;172.21.0.31:27018&quot;</span><span class="token punctuation">}</span>,
					<span class="token punctuation">{</span>_id:2, host:<span class="token string">&quot;172.21.0.32:27018&quot;</span><span class="token punctuation">}</span>,
					<span class="token punctuation">{</span>_id:3, host:<span class="token string">&quot;172.21.0.33:27018&quot;</span><span class="token punctuation">}</span>,
				<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token builtin class-name">exit</span>
<span class="token builtin class-name">exit</span>
<span class="token comment">#创建mongos服务,并连接mongos到分片集群</span>
docker run -itd <span class="token punctuation">\</span>
--net mongo21 --ip <span class="token number">172.21</span>.0.41 <span class="token punctuation">\</span>
--name mongo-router <span class="token punctuation">\</span>
-p <span class="token number">27017</span>:27017 mongo:5.0.3 <span class="token punctuation">\</span>
mongos --configdb config/172.21.0.11:27019,172.21.0.12:27019,172.21.0.13:27019 --bind_ip_all
<span class="token comment"># </span>
docker <span class="token builtin class-name">exec</span> -it mongo-router /bin/bash
mongo --host <span class="token number">172.21</span>.0.41 --port <span class="token number">27017</span>
sh.addShard<span class="token punctuation">(</span><span class="token string">&quot;shard/172.21.0.21:27018,172.21.0.22:27018,172.21.0.23:27018&quot;</span><span class="token punctuation">)</span>
sh.addShard<span class="token punctuation">(</span><span class="token string">&quot;shard1/172.21.0.31:27018,172.21.0.32:27018,172.21.0.33:27018&quot;</span><span class="token punctuation">)</span>
<span class="token comment"># 数据库启用分片</span>
use admin
sh.enableSharding<span class="token punctuation">(</span><span class="token string">&quot;db&quot;</span><span class="token punctuation">)</span>
sh.shardCollection<span class="token punctuation">(</span><span class="token string">&quot;db.collection&quot;</span>, <span class="token punctuation">{</span><span class="token string">&quot;_id&quot;</span><span class="token builtin class-name">:</span> <span class="token string">&quot;hashed&quot;</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token builtin class-name">exit</span>
<span class="token builtin class-name">exit</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br><span class="line-number">77</span><br><span class="line-number">78</span><br><span class="line-number">79</span><br><span class="line-number">80</span><br><span class="line-number">81</span><br><span class="line-number">82</span><br><span class="line-number">83</span><br><span class="line-number">84</span><br><span class="line-number">85</span><br><span class="line-number">86</span><br><span class="line-number">87</span><br><span class="line-number">88</span><br><span class="line-number">89</span><br><span class="line-number">90</span><br><span class="line-number">91</span><br><span class="line-number">92</span><br><span class="line-number">93</span><br><span class="line-number">94</span><br><span class="line-number">95</span><br><span class="line-number">96</span><br><span class="line-number">97</span><br><span class="line-number">98</span><br><span class="line-number">99</span><br><span class="line-number">100</span><br><span class="line-number">101</span><br><span class="line-number">102</span><br><span class="line-number">103</span><br><span class="line-number">104</span><br><span class="line-number">105</span><br><span class="line-number">106</span><br><span class="line-number">107</span><br><span class="line-number">108</span><br><span class="line-number">109</span><br><span class="line-number">110</span><br></div></div><p>客户端连接mongos时，可以指定readPrefrence选项为secondary，mongos会自动做读写分离。跟连接Mongod做读写分离一样的。</p> <img src="/assets/img/mongo连接成功.f56f8b95.png" alt=""></div> <!----> <div class="content__content-bottom"></div> <footer class="page-meta"><!----> <div class="meta-item update-time"><span class="label">Last update:</span> <span class="info">November 11, 2021 16:49</span></div> <div class="meta-item contributors"><span class="label">Contributors: </span> <span class="info"><span title="email: mashouyue@toowow.cn" class="contributor">
          m1-mba
        </span> <!----></span></div></footer> <!----> <!----> <!----> <div class="content__page-bottom"></div></main> <!----></div><div class="global-ui"><!----><!----><div id="pwa-install"><!----> <div id="install-modal-wrapper" style="display:none;"><div class="background"></div> <div class="install-modal"><div class="header"><button aria-label="Close" class="close-button"><svg width="23" height="22" xmlns="http://www.w3.org/2000/svg" class="icon close-icon"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.12.358a1.224 1.224 0 011.729 0l8.92 8.914L20.686.358a1.224 1.224 0 011.73 1.728L13.497 11l8.92 8.913a1.222 1.222 0 11-1.73 1.729l-8.919-8.913-8.92 8.913a1.224 1.224 0 01-1.729-1.729L10.04 11l-8.92-8.914a1.222 1.222 0 010-1.728z" fill="currentColor"></path></svg></button> <div class="logo"><!----> <div class="title"><h1></h1> <p class="desc">This app can be installed on your PC or mobile device.  This will allow this web app to look and behave like any other installed app.  You will find it in your app lists and be able to pin it to your home screen, start menus or task bars.  This installed web app will also be able to safely interact with other apps and your operating system. </p></div></div></div> <div class="content"><div class="highlight"><!----> <!----></div> <div class="description"><h3>Description</h3> <p></p></div></div> <div class="button-wrapper"><button class="install-button">
        Install <span></span></button> <button class="cancel-button">
        Cancel
      </button></div></div></div></div><div tabindex="-1" role="dialog" aria-hidden="true" class="pswp"><div class="pswp__bg"></div> <div class="pswp__scroll-wrap"><div class="pswp__container"><div class="pswp__item"></div> <div class="pswp__item"></div> <div class="pswp__item"></div></div> <div class="pswp__ui pswp__ui--hidden"><div class="pswp__top-bar"><div class="pswp__counter"></div> <button class="pswp__button pswp__button--close"></button> <button class="pswp__button pswp__button--share"></button> <button class="pswp__button pswp__button--fs"></button> <button class="pswp__button pswp__button--zoom"></button> <div class="pswp__preloader"><div class="pswp__preloader__icn"><div class="pswp__preloader__cut"><div class="pswp__preloader__donut"></div></div></div></div></div> <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"><div class="pswp__share-tooltip"></div></div> <button class="pswp__button pswp__button--arrow--left"></button> <button class="pswp__button pswp__button--arrow--right"></button> <div class="pswp__caption"><div class="pswp__caption__center"></div></div></div></div></div></div></div>
    <script src="/assets/js/app.e8388aea.js" defer></script><script src="/assets/js/vendors~layout-Layout.be7e8cd7.js" defer></script><script src="/assets/js/vendors~layout-Blog~layout-Layout~layout-NotFound.4f2b52fc.js" defer></script><script src="/assets/js/page-新mbp到了搭建开发环境过程.4eb65bf3.js" defer></script><script src="/assets/js/vendors~layout-Blog~layout-Layout~layout-NotFound~layout-Slide.82815501.js" defer></script>
  </body>
</html>
